home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / _SQLite_QueryFinalize.au3 < prev    next >
Text File  |  2007-09-08  |  1KB  |  26 lines

  1. #include <SQLite.au3>
  2. #include <SQLite.dll.au3>
  3.  
  4. Local $hQuery, $aRow, $aNames
  5. _SQLite_Startup ()
  6. _SQLite_Open () ; open :memory: Database
  7. _SQLite_Exec (-1, "CREATE TABLE aTest (a,b,c);")
  8. _SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('c','2','World');")
  9. _SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('b','3',' ');")
  10. _SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','Hello');")
  11. _SQlite_Query (-1, "SELECT ROWID,* FROM aTest ORDER BY a;", $hQuery)
  12. _SQLite_FetchNames ($hQuery, $aNames) ; Read out the Tablenames
  13. MsgBox(0,"SQLite","Row ID is : " & StringFormat(" %-10s  %-10s  %-10s  %-10s ", $aNames[0], $aNames[1], $aNames[2], $aNames[3]) & @CR)
  14. While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK ; This get 1 row at a time
  15.     MsgBox(0,"SQLite","Get Data using FetchData : " &  StringFormat(" %-10s  %-10s  %-10s  %-10s ", $aRow[0], $aRow[1], $aRow[2], $aRow[3]) & @CR)
  16.     _SQLite_QueryFinalize ($hQuery) ; This will stop the query, getting more rows
  17. WEnd
  18. _SQLite_Exec (-1, "DROP TABLE aTest;")
  19. _SQLite_Close ()
  20. _SQLite_Shutdown ()
  21.  
  22. ;~ Output:
  23. ;~  
  24. ;~  rowid       a           b           c          
  25. ;~  3           a           1           Hello      
  26.